package tech.aistar.corejava.day05.homework03;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:
 * @date 2019/7/23 0023
 */
public class TestProduct {
    public static void main(String[] args) {
        //初始化数组
        Product[] products = new Product[10];

        //模拟数据
        //未来的这些数据都是从数据库中加载出来的
        for (int i = 0; i < 10; i++) {
            Product p = new Product(i+1,"苹果"+i,295+i,"china");
            products[i] = p;
        }

        for (Product p:products){
            System.out.println(p);
        }

        System.out.println("===================");

        //找出价格高于300.0
        ProductBiz biz = new ProductBiz();

        Product[] pts = biz.getByPrice(products,300.0);

        if(null != pts && pts.length>0){
            for(Product p:pts){
                System.out.println(p);
            }
        }

        System.out.println("======");

        Product[] pps = biz.sort(products);
        for(Product p:biz.sort(products)){
            System.out.println(p);
        }
    }
}
